FROM microsoft/vsts-agent:windows-servercore-10.0.14393



ENV chocolateyUseWindowsCompression=false

RUN @powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"



RUN choco config set cachelocation C:\chococache



RUN choco install \

    git  \

    nodejs \

    jdk8 \

    curl \

    maven \

    gradle \

    ant \

    docker \

    ruby \

    visualstudio2015community \

    --confirm \

    ---limit-output \

    --timeout 216000

   # choco install visualstudio2015community --confirm --timeout 216000 \



# common node tools
RUN npm install gulp -g && npm install grunt -g && npm install -g less && npm install phantomjs-prebuilt -g

SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
# .NET Core SDK

ENV DOTNET_SDK_VERSION 1.0.0-preview3-004056
ENV DOTNET_SDK_DOWNLOAD_URL https://dotnetcli.blob.core.windows.net/dotnet/preview/Binaries/$DOTNET_SDK_VERSION/dotnet-dev-win-x64.$DOTNET_SDK_VERSION.zip

RUN powershell -NoProfile -Command \
        $ErrorActionPreference = 'Stop'; \
        Invoke-WebRequest %DOTNET_SDK_DOWNLOAD_URL% -OutFile dotnet.zip; \
        Expand-Archive dotnet.zip -DestinationPath '%ProgramFiles%\dotnet' -Force; \
        Remove-Item -Force dotnet.zip

# Install .NET Core
ENV DOTNET_VERSION 1.1.1
ENV DOTNET_DOWNLOAD_URL https://dotnetcli.blob.core.windows.net/dotnet/release/1.1.0/Binaries/$DOTNET_VERSION/dotnet-win-x64.$DOTNET_VERSION.zip

RUN Invoke-WebRequest $Env:DOTNET_DOWNLOAD_URL -OutFile dotnet.zip; \
    Expand-Archive dotnet.zip -DestinationPath $Env:ProgramFiles\dotnet -Force; \
    Remove-Item -Force dotnet.zip

# Install .NET Core
ENV DOTNET_VERSION 1.0.4
ENV DOTNET_DOWNLOAD_URL https://dotnetcli.blob.core.windows.net/dotnet/preview/Binaries/$DOTNET_VERSION/dotnet-win-x64.$DOTNET_VERSION.zip

RUN Invoke-WebRequest $Env:DOTNET_DOWNLOAD_URL -OutFile dotnet.zip; \
    Expand-Archive dotnet.zip -DestinationPath $Env:ProgramFiles\dotnet -Force; \
    Remove-Item -Force dotnet.zip
    
# Install .NET Core SDK
ENV DOTNET_SDK_VERSION 1.0.1
ENV DOTNET_SDK_DOWNLOAD_URL https://dotnetcli.blob.core.windows.net/dotnet/Sdk/$DOTNET_SDK_VERSION/dotnet-dev-win-x64.$DOTNET_SDK_VERSION.zip

RUN Invoke-WebRequest $Env:DOTNET_SDK_DOWNLOAD_URL -OutFile dotnet.zip; \
    Expand-Archive dotnet.zip -DestinationPath $Env:ProgramFiles\dotnet -Force; \
    Remove-Item -Force dotnet.zip

SHELL ["cmd", "/S", "/C"]






# .NET Core 1.1 Runtime

ENV DOTNET_VERSION 1.1.0

ENV DOTNET_DOWNLOAD_URL https://dotnetcli.blob.core.windows.net/dotnet/release/1.1.0/Binaries/$DOTNET_VERSION/dotnet-win-x64.$DOTNET_VERSION.zip



RUN powershell -NoProfile -Command \

        $ErrorActionPreference = 'Stop'; \

        Invoke-WebRequest %DOTNET_DOWNLOAD_URL% -OutFile dotnet.zip; \

        Expand-Archive dotnet.zip -DestinationPath '%ProgramFiles%\dotnet' -Force; \

        Remove-Item -Force dotnet.zip



# .NET Core SDK

# ENV DOTNET_SDK_VERSION 1.0.0-preview3-004056

# ENV DOTNET_SDK_DOWNLOAD_URL https://dotnetcli.blob.core.windows.net/dotnet/preview/Binaries/$DOTNET_SDK_VERSION/dotnet-dev-win-x64.$DOTNET_SDK_VERSION.zip



# RUN powershell -NoProfile -Command \

#        $ErrorActionPreference = 'Stop'; \

#        Invoke-WebRequest %DOTNET_SDK_DOWNLOAD_URL% -OutFile dotnet.zip; \

#        Expand-Archive dotnet.zip -DestinationPath '%ProgramFiles%\dotnet' -Force; \

#        Remove-Item -Force dotnet.zip



RUN setx /M PATH "%PATH%;%ProgramFiles%\dotnet"



# Trigger the population of the local package cache

ENV NUGET_XMLDOC_MODE skip



RUN mkdir C:\warmup \

    && cd C:\warmup \

    && dotnet new \

    && cd .. \

    && rmdir /S /Q C:\warmup \

    && rmdir /S /Q C:\chococache
